<template>
  <div>
    <div class="type_dialog">
      <el-dialog :visible.sync="dialogVisible" width="500px" height="210px">
        <template slot="title">
          <div class="tishi">
            <span> 提示</span>
          </div>
        </template>
        <div class="ser_igm">
          <div class="setimg">
            <img src="../../assets/img2/refused.png" />
          </div>
          <el-form
            :model="from"
            :rules="rules"
            ref="ruleForm"
            label-width="120px"
            class="demo-ruleForm"
          >
            <el-form-item :label="`${title}理由`" prop="text">
              <el-input
                v-model="from.text"
                :placeholder="`请输入${title}理由`"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
        <div slot="footer" class="dialog-footer">
          <button class="btn_add" @click="showType('ruleForm')">确定</button>
          <button @click="dialogVisible = false" class="can_btn">取 消</button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>
export default {
  name: 'AdminIndex',

  data() {
    return {
      dialogVisible: false,
      from: {
        text: ''
      },
      text: '',
      p_text: '',
      rules: {
        text: [{ required: true, message: '请输入理由', trigger: 'blur' }]
      }
    }
  },
  props: {
    title: {
      type: String,
      default: ()=>{
        return '拒绝'
      },
      required: false
    }
  },

  mounted() {},

  methods: {
    isshow() {
      this.from.text = ''
      this.dialogVisible = true
    },
    isshow2() {
      this.dialogVisible = false
    },
    showType(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
            this.$emit('showfalse', this.from.text)
        } else {
          console.log('error submit!!')
          return false
        }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import './style.scss';
</style>
